feat: build metadata architecture (npmx.dev/wolfstar.rocks pattern) with non-Vercel runtime fallback - #61
Closed
RedStar071 wants to merge 9 commits into
Closed
feat: build metadata architecture (npmx.dev/wolfstar.rocks pattern) with non-Vercel runtime fallback#61RedStar071 wants to merge 9 commits into
RedStar071 wants to merge 9 commits into
Conversation
…lback Adds packages/build-env, resolving version/commit/branch/deploy-channel from the hosting provider first and the checkout second (matching the npmx.dev and wolfstar.rocks pattern), and registers it as a Nuxt module in the dashboard and marketing apps. Vercel resolves everything at build time. Every other target — a container image built in CI, a self-hosted `node .output/server/index.mjs` — resolves what it can from the checkout and completes the rest from AGENT_ZERO_BUILD_* at server start, so a non-Vercel deployment still reports the commit it is actually serving.
Adds BuildEnvironment.vue (mirroring wolfstar.rocks' component of the
same name), rendered in the sidebar below UserMenu: build date, the
release version or deploy channel, and a linked short commit.
Replaces the sidebar's package.json-sourced version with useBuildInfo(),
so version, deploy channel, and commit come from one resolved source
instead of two that could drift. common.version.label becomes
common.build.{label,releaseAria,commitAria} in en/it, with the schema
regenerated.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR introduces a new cross-application build metadata subsystem with provider detection, build/server resolution, public runtime configuration, cache changes, prerender integration, and new dashboard UI. Its broad deployment and runtime surface is beyond a small self-contained change and warrants human review. You can add or adjust custom eligibility rules. Learn more. |
• Replace unknownRevision sentinel with null for commit and branch fields • Remove nullable() helper and update BuildInfo type • Simplify runtime field completion with consistent null coalescing
- Remove absoluteUrlPattern regex and its comment - No longer needed after recent metadata handling refactor
- Use ufo's withHttps for URL normalization instead of manual regex - Pass deployment configuration to providers via ProviderOptions - Support defaultBranch configuration for production branch detection
- Remove `shortCommit` from `BuildInfo` type; compute via `shortenCommit()` function - Complete null-based revision field handling throughout - Improve `defaultBranch` parameter passing to providers - Simplify `package.json` reading with `pkg-types`
- Add normalizeBuildInfo to convert Nuxt's empty string serialization back to null - Clear stale preview/production URLs when environment classification changes - Preserve explicit URL schemes instead of always upgrading to https - Update Turbo cache inputs to include git refs for proper build cache busting - Remove shortCommit field references; derive via shortenCommit() on-demand
Signed-off-by: RedStar <redstar071@proton.me>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
packages/build-env: resolves what a Nuxt build is — version, commit, branch, deploychannel (
dev/preview/canary/release), deploy URL — the way npmx.dev'sconfig/env.tsandwolfstar.rocks'
config/env.ts+modules/build-env.tsdo, and registers it as a Nuxt module inboth
apps/dashboardandapps/marketing.The dashboard now shows that metadata under the signed-in user: a new
BuildEnvironment.vue(mirroring wolfstar.rocks' component of the same name) renders build date, release version or
deploy channel, and a linked short commit, in the sidebar below
UserMenu. It replaces thesidebar's previous
package.json-sourced version display, so version/channel/commit come from oneresolved source instead of two that could drift.
Why
The build-time resolution (npmx.dev/wolfstar.rocks pattern) reads a hosting provider's own git
variables first (
VERCEL_GIT_*, Netlify'sCOMMIT_REF/CONTEXT, etc.) and the checkout second.That works cleanly on Vercel, where every field is known while the build runs — but this project
also ships a self-hosted
node .output/server/index.mjsbundle and can run behind other hosts(Netlify, Cloudflare Pages, a plain container built in CI), none of which expose those variables
to the build step.
So this adds a second, run-time pass (
runtimeBuildInfo) that completes only the fields the buildleft as an
unknownsentinel, from whatever environment the server actually starts in —AGENT_ZERO_BUILD_COMMIT/_BRANCH/_PR_NUMBER/_URL/_PRODUCTION_URL/_ENVfor a deploymentthat wants to state itself outright, or auto-detected from Netlify/Cloudflare Pages/GitHub Actions
variables at boot. A field the build resolved is never overwritten — the commit a bundle was
compiled from is a property of the bundle, not of the machine serving the request. On Vercel this
pass is a no-op (same variables, same answer), so nothing changes for that target.
Package boundary:
packages/build-envis explicitly not a runtime package —packages/agent,packages/runner, and their adapters may not import it (documented inAGENTS.md). It has twoentry points matching its two halves:
.(pure, no filesystem/subprocess/@nuxt/kit, safe insidea serverless bundle) and
./nuxt(the build-time module, pulls in@nuxt/kit).Verification
aube run check:repoaube run lint:ciaube run typecheckaube testaube run build(excludingapps/docs, which OOMs on this branch and onmainalike —pre-existing, unrelated to this change; verified by stashing the one file touched there and
reproducing the identical crash)
Safety and compatibility
observemode as read-only, or explained the policy change above.Agent context
verification.
packages/build-env(provider table, git fallback, build-time/run-time resolution passes, Nuxtmodule), wired it into both apps, wrote the
BuildEnvironment.vuecomponent and sidebarintegration, updated i18n locales/schema, docs,
.env.example,turbo.jsonc,AGENTS.md, andthe accompanying test suites. I reviewed the diff, confirmed the check suite and full build pass,
and confirmed the
apps/docsOOM is pre-existing rather than introduced by this change.Reviewer notes
feat(build-env)(the package + Nuxt wiring + docs) andfeat(dashboard)(the sidebar UI + i18n), so the architecture and its one consumer can bereviewed separately.
apps/docsbuild was excluded from the full-workspace verification run above due to apre-existing out-of-memory crash unrelated to this PR; worth a follow-up issue if not already
tracked.
Note
Add
@agent-zero/build-envpackage for build metadata resolution across Nuxt appspackages/build-envwith two-pass resolution:resolveBuildInfocollects metadata at build time from provider env vars, git, andpackage.json;runtimeBuildInfocompletes unresolved fields on the server without overwriting build-time valuesdeploymentMetadataFromEnvironment; classifies env asdev,release,canary, orpreviewruntimeConfig.public.buildInfoand generates a tree-shakableuseBuildInfo()composable that memoizes server-completed values for client hydration<BuildEnvironment />component showing timestamp, channel/release link, and optional commit link; marketing app also adopts the moduleAGENT_ZERO_BUILD_*overrides to.env.examplefilesnormalizeBuildInfoconverts blank strings back tonullfor nullable fields because Nuxt runtimeConfig serializes missing values as empty strings; the i18nversionkey group is renamed tobuildinenanditlocalesMacroscope summarized 9013919.